#ifndef __PHIDGET_H__
#define __PHIDGET_H__

#include <list>
#include <string>

#ifdef __APPLE__
 #import <Phidget21/phidget21.h>
#else
#endif

class PhidgetManager;

class Phidget
{
	protected:
	CPhidgetHandle	handle;

	Phidget();
	void CommonInit();
	virtual void AttachHandler();

	private:
	int 			serialNumber;
	bool 			_isAttached;
	const char		*deviceType;
	static int AttachHandler(CPhidgetHandle inHandle, void *userdata);
	
	public:
	Phidget(CPhidgetHandle inHandle);
	~Phidget();
	static Phidget *ConstructPhidget(CPhidgetHandle inHandle, PhidgetManager *manager);

	bool isAttached();	
	int SerialNumber();
	const char *DeviceType();
	
	virtual std::list<std::string> SupportedProperties();
	virtual std::string GetPropertyValue(std::string property);
	virtual void SetPropertyValue(std::string property, std::string value);
	
	//
	// Declare the friends of this class.
	//
	friend class PhidgetManager;
};

#endif /* __PHIDGET_H__ */

